﻿<%@ Page validateRequest="false" Language="C#" AutoEventWireup="true" CodeBehind="EditPresentationElement.aspx.cs" Inherits="BEELab.EditPresentationElement" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" href='./Content/css/style.css' />
    <link rel="stylesheet" type="text/css" href='./Content/css/source/jquery.fancybox.css' media="screen" />
    <script src='<%: ResolveClientUrl("~/Scripts/jquery-1.10.2.min.js")%>'></script>
    <script src='<%: ResolveClientUrl("~/Content/css/source/jquery.fancybox.js?v=2.1.5")%>'></script>
    <script src='<%: ResolveClientUrl("~/Content/js/tinymce/tinymce.min.js")%>'></script>

    <script>
            tinyMCE.init({
                selector: 'textarea.tiny-content',
                resize: false,
                valid_elements : '+*[*]',
                toolbar1: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
                toolbar2: "variables_button | presentation_button | addcont | addpost | code preview | forecolor backcolor emoticons",
                plugins: ["code image link lists autolink advlist preview visualblocks insertdatetime table paste directionality nonbreaking "],
                <% if (Request.QueryString["CustomMenus"] == null || Request.QueryString["CustomMenus"].ToString().Equals("false") == false ){%>
                setup: function (editor) {
                    editor.addButton('variables_button', {
                        type: 'menubutton',
                        text: 'Variables',
                        plugins: [ 'code ' ],
                        icon: false,
                        menu: [
                            <asp:Literal ID="VariablesLiteral" runat="server"></asp:Literal>
                        ]
                    });
                    editor.addButton('presentation_button', {
                        type: 'menubutton',
                        text: 'Presentation Elements',
                        icon: false,
                        menu: [
                            <asp:Literal ID="PresentationLiteral" runat="server"></asp:Literal>
                        ]
                    });
                    editor.addButton('addcont', {
                        type: 'menubutton',
                        text: 'Add Controls',
                        icon: false,
                        menu: [
                            {text: 'Text', onclick: function() {
                                $.fancybox.open({
                                    padding : 0,
                                    href:'AddHTMLControl.aspx?type=text',
                                    type: 'iframe',
                                    helpers : { 
                                        overlay : {closeClick: false}
                                    }
                                });
                            }},
                            
                            {text: 'Button', onclick: function() {
                                $.fancybox.open({
                                    padding : 0,
                                    href:'AddHTMLControl.aspx?type=button',
                                    type: 'iframe',
                                    helpers : { 
                                        overlay : {closeClick: false}
                                    }
                                });
                            }},

                            {text: 'Checkbox', onclick: function() {
                                $.fancybox.open({
                                    padding : 0,
                                    href:'AddHTMLControl.aspx?type=checkbox',
                                    type: 'iframe',
                                    helpers : { 
                                        overlay : {closeClick: false}
                                    }
                                });
                            }},

                            {text: 'Radio', onclick: function() {
                                $.fancybox.open({
                                    padding : 0,
                                    href:'AddHTMLControl.aspx?type=radio',
                                    type: 'iframe',
                                    helpers : { 
                                        overlay : {closeClick: false}
                                    }
                                });
                            }}
                            
                    ]
                    });
                    
                    editor.addButton('addpost', {
                        text: 'Add Submit Button',
                        icon: false,
                        onclick: function() {
                            editor.insertContent('<input type="button" onclick="OnPost();" value="Submit"/>');
                        }
                    });
                }
                <% } %>
            });
    </script>

</head>
<body style="width: 700px; padding: 24px; background-color:#ffffff">
    <asp:literal id="literal1" runat="server"></asp:literal>
    <form id="form1" runat="server">
        <div id="Div1" class="clearfix">
            <div id="new-presentation">
                <asp:Label id="lblHeadline" runat="server"><h2 class="headline" >New Presentation Element</h2></asp:Label>
                <div class="sign-form">
                    <div class="input-hold">
                        <asp:Label ID="Label15" CssClass="sign-label" AssociatedControlID="TextBox1" runat="server">Name</asp:Label>
                        <asp:TextBox CssClass="sign-input" ID="TextBox1" runat="server" Width="200px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator8" ForeColor="Red" Text="*" ValidationGroup="PresentationGroup" ControlToValidate="TextBox1" runat="server" ErrorMessage="* Name is required"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ValidationExpression=".*" EnableClientScript="True" ID="RegexValidator2" ForeColor="Red" ValidationGroup="PresentationGroup" ControlToValidate="TextBox1" runat="server" ErrorMessage="* Name already in use"></asp:RegularExpressionValidator>
                    </div>

                    <div class="input-hold">
                        <asp:Label ID="Label16" CssClass="sign-label" AssociatedControlID="TextBox3" runat="server">Description</asp:Label>
                        <asp:TextBox CssClass="sign-input" ID="TextBox3" runat="server" Width="200px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator9" ForeColor="Red" Text="*" ValidationGroup="PresentationGroup" ControlToValidate="TextBox3" runat="server" ErrorMessage="* Description is required"></asp:RequiredFieldValidator>
                    </div>

                    <div class="spacer" style="height: 1px"></div>

                    <div class="editor">
                        <asp:TextBox ID="TextBox2" CssClass="tiny-content" runat="server" TextMode="MultiLine" Style="width: 80%; min-height: 230px; resize: none;">Your Content Here</asp:TextBox>
                    </div>

                    <div class="input-hold">
                        <asp:Button ID="Button4" CssClass="sign-submit" Text="Submit" runat="server" OnClick="btnContent_Click" OnClientClick="tinyMCE.triggerSave();" />
                    </div>
                    <div class="error">
                        <asp:ValidationSummary ID="ValidationSummary3" runat="server" ValidationGroup="PresentationGroup" />
                        <p>&nbsp</p>
                    </div>
                </div>
            </div>
        </div>
    </form>
</body>
</html>
